-- tarot
-- created by panyl
-- 下楼获得塔罗牌

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 进入下一层触发
    trigger = function(who, prop, arg)
        local floor = DungeonM.currentLayer();
        local num  = 1;
        
        -- 不在对应楼层不给
        if floor % 2 ~= 0 then
            return false;
        end
        
        if floor == 1 then
            -- 首次进入迷宫时，不在这里处理
            local max_dungeon_layer = ME.user.dbase:query("max_dungeon_layer", 0);
            if max_dungeon_layer <= 1 then
                return false;
            end
        end

        -- 如果是在副本中就不能抽了
        if DungeonInstanceM.isInInstance() or
            UnrealDungeonM.isInUnreal() then
            return false;
        end

        TarotM.drawCard(num);
        return true;
    end,

    record = function(target, prop, path)
        return false;
    end
};
